package com.heimo.gogocheque.core;

import android.content.Context;
import android.content.SharedPreferences;

public class PrefHelper {
	private static final String TAG = "PrefHelper";
	private static final String PREFS_NAME = "com.heimo.gogocheque.PrefHelper";
	private static final String PREF_PREFIX_SPONSOR_KEY = "gogocheque_has_sponsored";

	// Delete all Preference
	public static void fnDeletePref(Context ctx, int appWidgetId) {
		SharedPreferences.Editor prefs = ctx
				.getSharedPreferences(PREFS_NAME, 0).edit();
		prefs.remove(PREF_PREFIX_SPONSOR_KEY + appWidgetId);
		prefs.commit();
	}

	// Sponsor Preference Start
	public static boolean hasSponsor(Context context) {
		SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
		boolean b = prefs.getBoolean(PREF_PREFIX_SPONSOR_KEY, false);
		LogHelper.log(TAG, "Pref : " + PREF_PREFIX_SPONSOR_KEY + " | " + b);
		return b;
	}

	public static void fnSaveSponsor(Context context) {
		SharedPreferences.Editor prefs = context.getSharedPreferences(
				PREFS_NAME, 0).edit();
		prefs.putBoolean(PREF_PREFIX_SPONSOR_KEY, true);
		prefs.commit();
	}
	// Sponsor Preference End
	
}
